diff --git a/packages/react-native-web-examples/next.config.js b/packages/react-native-web-examples/next.config.js index 7fcc182978..f2b93d65c6 100644 --- a/packages/react-native-web-examples/next.config.js +++ b/packages/react-native-web-examples/next.config.js @@ -8,5 +8,9 @@ const pages = fs module.exports = { outDir: 'dist', - env: { pages } + env: { pages }, + webpack: (config, options) => { + config.resolve.alias['react-native'] = 'react-native-web'; + return config; + } }; diff --git a/packages/react-native-web-examples/pages/clipboard/index.js b/packages/react-native-web-examples/pages/clipboard/index.js index d2f19a265d..6fefd315f6 100644 --- a/packages/react-native-web-examples/pages/clipboard/index.js +++ b/packages/react-native-web-examples/pages/clipboard/index.js @@ -1,5 +1,6 @@ -import { Button, Clipboard, StyleSheet, TextInput, View } from 'react-native'; +import { Clipboard, StyleSheet, TextInput, View } from 'react-native'; import React from 'react'; +import Button from '../../shared/button'; import Example from '../../shared/example'; export default function ClipboardPage() { diff --git a/packages/react-native-web-examples/pages/image/index.js b/packages/react-native-web-examples/pages/image/index.js index 5cc756bf47..086a21a674 100644 --- a/packages/react-native-web-examples/pages/image/index.js +++ b/packages/react-native-web-examples/pages/image/index.js @@ -47,7 +47,11 @@ export default function ImagePage() { Static image - + Progressive JPEG @@ -143,8 +147,7 @@ const styles = StyleSheet.create({ borderColor: 'black', borderWidth: 0.5, height: 120, - width: 120, - resizeMode: 'cover' + width: 120 }, resizeMode: { borderColor: 'black', diff --git a/packages/react-native-web-examples/pages/index.js b/packages/react-native-web-examples/pages/index.js index 011dda4f33..e1e8ecddb0 100644 --- a/packages/react-native-web-examples/pages/index.js +++ b/packages/react-native-web-examples/pages/index.js @@ -8,11 +8,7 @@ const logoUri = function Link(props) { return ( - + ); } @@ -22,7 +18,7 @@ export default function IndexPage() { - + {process.env.pages.map((name) => ( - + {name} diff --git a/packages/react-native-web-examples/pages/linking/index.js b/packages/react-native-web-examples/pages/linking/index.js index 125133a5b1..3e8471a7f9 100644 --- a/packages/react-native-web-examples/pages/linking/index.js +++ b/packages/react-native-web-examples/pages/linking/index.js @@ -18,11 +18,11 @@ export default class LinkingPage extends PureComponent { Linking.openURL target="_blank" diff --git a/packages/react-native-web-examples/pages/lists/index.js b/packages/react-native-web-examples/pages/lists/index.js index bc4407c632..33bc86fa5f 100644 --- a/packages/react-native-web-examples/pages/lists/index.js +++ b/packages/react-native-web-examples/pages/lists/index.js @@ -15,7 +15,7 @@ import { Image, StyleSheet, Switch, - TouchableHighlight, + Pressable, Text, TextInput, View @@ -92,14 +92,11 @@ class ItemComponent extends React.PureComponent<{ const itemHash = Math.abs(hashCode(item.title)); const imgSource = THUMB_URLS[itemHash % THUMB_URLS.length]; return ( - - + ); } } @@ -172,15 +169,11 @@ class Spindicator extends React.PureComponent<{}> { style={[ styles.spindicator, { - transform: [ - { - rotate: this.props.value.interpolate({ - inputRange: [0, 5000], - outputRange: ['0deg', '360deg'], - extrapolate: 'extend' - }) - } - ] + rotate: this.props.value.interpolate({ + inputRange: [0, 5000], + outputRange: ['0deg', '360deg'], + extrapolate: 'extend' + }) } ]} /> @@ -263,9 +256,7 @@ class SingleColumnExample extends React.PureComponent { }; _onChangeScrollToIndex = (text) => { - this._listRef - .getNode() - .scrollToIndex({ viewPosition: 0.5, index: Number(text) }); + this._listRef.scrollToIndex({ viewPosition: 0.5, index: Number(text) }); }; _scrollPos = new Animated.Value(0); @@ -283,7 +274,7 @@ class SingleColumnExample extends React.PureComponent { ); componentDidUpdate() { - this._listRef.getNode().recordInteraction(); // e.g. flipping logViewable switch + this._listRef.recordInteraction(); // e.g. flipping logViewable switch } render() { @@ -398,7 +389,7 @@ class SingleColumnExample extends React.PureComponent { } }; _pressItem = (key: string) => { - this._listRef.getNode().recordInteraction(); + this._listRef.recordInteraction(); pressItem(this, key); }; _listRef: AnimatedFlatList; @@ -469,7 +460,7 @@ const styles = StyleSheet.create({ smallSwitch: { top: 1, margin: -6, - transform: [{ scale: 0.7 }] + transform: 'scale(0.7)' }, stacked: { alignItems: 'center', diff --git a/packages/react-native-web-examples/pages/localization/index.js b/packages/react-native-web-examples/pages/localization/index.js index 5c279066c3..2cc53d6e63 100644 --- a/packages/react-native-web-examples/pages/localization/index.js +++ b/packages/react-native-web-examples/pages/localization/index.js @@ -12,9 +12,9 @@ import React from 'react'; import { - Button, Image, PixelRatio, + Pressable, ScrollView, StyleSheet, Text, @@ -41,7 +41,9 @@ function ListItem(props) { -