-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[web] Added support for Expo web #58
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,7 @@ | |
'use strict'; | ||
|
||
import React from 'react'; | ||
import ReactNative from 'react-native'; | ||
const { | ||
AppRegistry, | ||
StyleSheet, | ||
View, | ||
} = ReactNative; | ||
import { AppRegistry, StyleSheet, View } from 'react-native'; | ||
|
||
import ParsedText from 'react-native-parsed-text'; | ||
|
||
|
@@ -45,22 +40,39 @@ class Example extends React.Component { | |
<View style={styles.container}> | ||
<ParsedText | ||
style={styles.text} | ||
parse={ | ||
[ | ||
{type: 'url', style: styles.url, onPress: this.handleUrlPress}, | ||
{type: 'phone', style: styles.phone, onPress: this.handlePhonePress}, | ||
{type: 'email', style: styles.email, onPress: this.handleEmailPress}, | ||
{pattern: /Bob|David/, style: styles.name, onPress: this.handleNamePress}, | ||
{pattern: /\[(@[^:]+):([^\]]+)\]/i, style: styles.username, onPress: this.handleNamePress, renderText: this.renderText}, | ||
{pattern: /42/, style: styles.magicNumber}, | ||
{pattern: /#(\w+)/, style: styles.hashTag}, | ||
] | ||
} | ||
parse={[ | ||
{ type: 'url', style: styles.url, onPress: this.handleUrlPress }, | ||
{ | ||
type: 'phone', | ||
style: styles.phone, | ||
onPress: this.handlePhonePress, | ||
}, | ||
{ | ||
type: 'email', | ||
style: styles.email, | ||
onPress: this.handleEmailPress, | ||
}, | ||
{ | ||
pattern: /Bob|David/, | ||
style: styles.name, | ||
onPress: this.handleNamePress, | ||
}, | ||
{ | ||
pattern: /\[(@[^:]+):([^\]]+)\]/i, | ||
style: styles.username, | ||
onPress: this.handleNamePress, | ||
renderText: this.renderText, | ||
}, | ||
{ pattern: /42/, style: styles.magicNumber }, | ||
{ pattern: /#(\w+)/, style: styles.hashTag }, | ||
]} | ||
> | ||
Hello this is an example of the ParsedText, links like http://www.google.com or http://www.facebook.com are clickable and phone number 444-555-6666 can call too. | ||
But you can also do more with this package, for example Bob will change style and David too. You should mention [@michel:5455345] about that. [email protected] | ||
And the magic number is 42! | ||
#react #react-native | ||
Hello this is an example of the ParsedText, links like | ||
http://www.google.com or http://www.facebook.com are clickable and | ||
phone number 444-555-6666 can call too. But you can also do more with | ||
this package, for example Bob will change style and David too. You | ||
should mention [@michel:5455345] about that. [email protected] And the | ||
magic number is 42! #react #react-native | ||
</ParsedText> | ||
</View> | ||
); | ||
|
@@ -111,7 +123,6 @@ const styles = StyleSheet.create({ | |
hashTag: { | ||
fontStyle: 'italic', | ||
}, | ||
|
||
}); | ||
|
||
AppRegistry.registerComponent('Example', () => Example); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,13 @@ | |
'use strict'; | ||
|
||
import React from 'react'; | ||
import ReactNative from 'react-native'; | ||
EvanBacon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const { | ||
import { | ||
AppRegistry, | ||
StyleSheet, | ||
View, | ||
LinkingIOS, | ||
AlertIOS, | ||
} = ReactNative; | ||
} from 'react-native'; | ||
|
||
import ParsedText from 'react-native-parsed-text'; | ||
|
||
|
@@ -47,22 +46,39 @@ class Example extends React.Component { | |
<View style={styles.container}> | ||
<ParsedText | ||
style={styles.text} | ||
parse={ | ||
[ | ||
{type: 'url', style: styles.url, onPress: this.handleUrlPress}, | ||
{type: 'phone', style: styles.phone, onPress: this.handlePhonePress}, | ||
{type: 'email', style: styles.email, onPress: this.handleEmailPress}, | ||
{pattern: /Bob|David/, style: styles.name, onPress: this.handleNamePress}, | ||
{pattern: /\[(@[^:]+):([^\]]+)\]/i, style: styles.username, onPress: this.handleNamePress, renderText: this.renderText}, | ||
{pattern: /42/, style: styles.magicNumber}, | ||
{pattern: /#(\w+)/, style: styles.hashTag}, | ||
] | ||
} | ||
parse={[ | ||
{ type: 'url', style: styles.url, onPress: this.handleUrlPress }, | ||
{ | ||
type: 'phone', | ||
style: styles.phone, | ||
onPress: this.handlePhonePress, | ||
}, | ||
{ | ||
type: 'email', | ||
style: styles.email, | ||
onPress: this.handleEmailPress, | ||
}, | ||
{ | ||
pattern: /Bob|David/, | ||
style: styles.name, | ||
onPress: this.handleNamePress, | ||
}, | ||
{ | ||
pattern: /\[(@[^:]+):([^\]]+)\]/i, | ||
style: styles.username, | ||
onPress: this.handleNamePress, | ||
renderText: this.renderText, | ||
}, | ||
{ pattern: /42/, style: styles.magicNumber }, | ||
{ pattern: /#(\w+)/, style: styles.hashTag }, | ||
]} | ||
> | ||
Hello this is an example of the ParsedText, links like http://www.google.com or http://www.facebook.com are clickable and phone number 444-555-6666 can call too. | ||
But you can also do more with this package, for example Bob will change style and David too. You should mention [@michel:5455345] about that. [email protected] | ||
And the magic number is 42! | ||
#react #react-native | ||
Hello this is an example of the ParsedText, links like | ||
http://www.google.com or http://www.facebook.com are clickable and | ||
phone number 444-555-6666 can call too. But you can also do more with | ||
this package, for example Bob will change style and David too. You | ||
should mention [@michel:5455345] about that. [email protected] And the | ||
magic number is 42! #react #react-native | ||
</ParsedText> | ||
</View> | ||
); | ||
|
@@ -113,7 +129,6 @@ const styles = StyleSheet.create({ | |
hashTag: { | ||
fontStyle: 'italic', | ||
}, | ||
|
||
}); | ||
|
||
AppRegistry.registerComponent('Example', () => Example); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
module.exports = { | ||
retainLines: true, | ||
compact: true, | ||
comments: false, | ||
presets: ["module:metro-react-native-babel-preset"], | ||
sourceMaps: false | ||
module.exports = function(api) { | ||
EvanBacon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (!!api) { | ||
api.cache(true); | ||
} | ||
return { | ||
presets: ['babel-preset-expo'], | ||
EvanBacon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any significant changes in this file that need to be reviewed? Most of them look like Formatting changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default export of
react-native
has been removed from web and will be removed from native soon. I opened this PR right after deleting it. It was removed because it causes all of the RN module to be bundled regardless of if you are using them or not.