Skip to content

Sync fork with upstream #19

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion configs/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
<PROJECT_ROOT>/packages/.*/dist/.*
<PROJECT_ROOT>/packages/react-native-web-docs/.*
<PROJECT_ROOT>/packages/react-native-web-examples/.*
.*/node_modules/.*/.*.json

[include]

[declarations]
.*/node_modules/.*

[libs]

[options]
indexed_access=true
munge_underscores=true
40 changes: 32 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/babel-plugin-react-native-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"registry": "https://registry.npmjs.org/"
},
"name": "babel-plugin-react-native-web",
"version": "0.19.1",
"version": "0.19.4",
"description": "Babel plugin for React Native for Web",
"main": "index.js",
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/babel-plugin-react-native-web/src/moduleMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
AppRegistry: true,
AppState: true,
Appearance: true,
BackHandler: true,
Button: true,
CheckBox: true,
Clipboard: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-web-docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "react-native-web-docs",
"version": "0.19.1",
"version": "0.19.4",
"description": "Documentation website for React Native for Web",
"scripts": {
"dev": "eleventy --serve",
Expand Down
7 changes: 5 additions & 2 deletions packages/react-native-web-examples/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const pages = fs
.map((dirent) => dirent.name);

module.exports = {
outDir: 'dist',
env: { pages }
env: { pages },
webpack: (config, options) => {
config.resolve.alias['react-native'] = 'react-native-web';
return config;
}
};
6 changes: 3 additions & 3 deletions packages/react-native-web-examples/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"private": true,
"name": "react-native-web-examples",
"version": "0.19.1",
"version": "0.19.4",
"scripts": {
"build": "next build",
"dev": "next",
"start": "next start"
},
"dependencies": {
"babel-plugin-react-native-web": "0.19.1",
"babel-plugin-react-native-web": "0.19.4",
"next": "^12.2.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-native-web": "0.19.1"
"react-native-web": "0.19.4"
},
"devDependencies": {
"@babel/core": "^7.18.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-web-examples/pages/checkbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function CheckboxPage() {
<Divider />
<CheckBox disabled style={styles.item} value={true} />
<Divider />
<CheckBox accessibilityReadOnly style={styles.item} value={true} />
<CheckBox aria-readonly style={styles.item} value={true} />
</View>
<View style={styles.row}>
<CheckBox value={false} />
Expand Down
3 changes: 2 additions & 1 deletion packages/react-native-web-examples/pages/clipboard/index.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
9 changes: 6 additions & 3 deletions packages/react-native-web-examples/pages/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export default function ImagePage() {
<View style={styles.row}>
<View style={styles.column}>
<Text style={styles.text}>Static image</Text>
<Image source={'/image/ladybug.jpg'} style={styles.image} />
<Image
resizeMode="cover"
source={'/image/ladybug.jpg'}
style={styles.image}
/>
</View>
<View style={styles.column}>
<Text style={styles.text}>Progressive JPEG</Text>
Expand Down Expand Up @@ -166,8 +170,7 @@ const styles = StyleSheet.create({
borderColor: 'black',
borderWidth: 0.5,
height: 120,
width: 120,
resizeMode: 'cover'
width: 120
},
resizeMode: {
borderColor: 'black',
Expand Down
18 changes: 7 additions & 11 deletions packages/react-native-web-examples/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ const logoUri =
function Link(props) {
return (
<NextLink href={props.href}>
<Text
{...props}
accessibilityRole="link"
style={[styles.link, props.style]}
/>
<Text {...props} role="link" style={[styles.link, props.style]} />
</NextLink>
);
}
Expand All @@ -22,7 +18,7 @@ export default function IndexPage() {
<View style={styles.app}>
<View style={styles.header}>
<Image
accessibilityLabel="React logo"
aria-label="React logo"
resizeMode="contain"
source={{ uri: logoUri }}
style={styles.logo}
Expand All @@ -36,9 +32,9 @@ export default function IndexPage() {
example app built on Next.js
</Text>

<View accessibilityRole="list">
<View role="list">
{process.env.pages.map((name) => (
<View accessibilityRole="listitem" key={name} style={styles.listitem}>
<View key={name} role="listitem" style={styles.listitem}>
<Link href={'/' + name} style={styles.pageLink}>
{name}
</Link>
Expand Down Expand Up @@ -77,11 +73,11 @@ const styles = StyleSheet.create({
color: '#1977f2'
},
listitem: {
marginVertical: '0.5rem',
textAlign: 'center'
marginVertical: '0.5rem'
},
pageLink: {
fontSize: '1.25rem',
fontWeight: 'bold'
fontWeight: 'bold',
textAlign: 'center'
}
});
59 changes: 36 additions & 23 deletions packages/react-native-web-examples/pages/linking/index.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
import { Linking, StyleSheet, Text } from 'react-native';
import React, { PureComponent } from 'react';
import React from 'react';
import Example from '../../shared/example';

const url = 'https://mathiasbynens.github.io/rel-noopener/malicious.html';

export default class LinkingPage extends PureComponent {
handlePress() {
export default function LinkingPage(props) {
const [, setCount] = React.useState(0);

React.useEffect(() => {
console.log('adding listener');
const listener = Linking.addEventListener('onOpen', () => {
console.log('onOpen event');
});
return () => {
console.log('removing listener');
listener.remove();
};
});

function handlePress() {
Linking.canOpenURL(url).then((supported) => {
return Linking.openURL(url);
setCount((x) => x + 1);
const v = Linking.openURL(url);
return v;
});
}

render() {
return (
<Example title="Linking">
<Text onPress={this.handlePress} style={styles.text}>
Linking.openURL
</Text>
<Text
accessibilityRole="link"
href="https://mathiasbynens.github.io/rel-noopener/malicious.html"
hrefAttrs={{
target: '_blank'
}}
style={styles.text}
>
target="_blank"
</Text>
</Example>
);
}
return (
<Example title="Linking">
<Text onPress={handlePress} style={styles.text}>
Linking.openURL
</Text>
<Text
href="https://mathiasbynens.github.io/rel-noopener/malicious.html"
hrefAttrs={{
target: '_blank'
}}
role="link"
style={styles.text}
>
target="_blank"
</Text>
</Example>
);
}

const styles = StyleSheet.create({
Expand Down
Loading