Skip to content
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

Adjust Platform constants import #1211

Merged
merged 5 commits into from
Feb 13, 2021
Merged
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
6 changes: 3 additions & 3 deletions ci/e2e/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ class MainScreen extends React.Component {
title: '✌️ Gesture Handler Demo',
};
render() {
const data = Object.keys(SCREENS).map(key => ({ key }));
const data = Object.keys(SCREENS).map((key) => ({ key }));
return (
<FlatList
style={styles.list}
data={data}
ItemSeparatorComponent={ItemSeparator}
renderItem={props => (
renderItem={(props) => (
<MainScreenItem
{...props}
onPressItem={({ key }) => this.props.navigation.navigate(key)}
/>
)}
renderScrollComponent={props => <ScrollView {...props} />}
renderScrollComponent={(props) => <ScrollView {...props} />}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion ci/e2e/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = api => {
module.exports = (api) => {
const isWeb = api.caller(isTargetWeb);

return {
Expand Down
4 changes: 1 addition & 3 deletions ci/e2e/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export class LoremIpsum extends React.Component {
style: styles.lipsum,
};
loremIpsum() {
return LOREM_IPSUM.split(' ')
.slice(0, this.props.words)
.join(' ');
return LOREM_IPSUM.split(' ').slice(0, this.props.words).join(' ');
}
render() {
return <Text style={this.props.style}>{this.loremIpsum()}</Text>;
Expand Down
4 changes: 2 additions & 2 deletions ci/e2e/e2e/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ before(async () => {
await detox.init(config);
});

beforeEach(async function() {
beforeEach(async function () {
await adapter.beforeEach(this);
});

afterEach(async function() {
afterEach(async function () {
await adapter.afterEach(this);
});

Expand Down
6 changes: 3 additions & 3 deletions ci/e2e/multitap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ export class PressBox extends Component {
lastGH: false,
};
doubleTapRef = React.createRef();
_onHandlerStateChange = event => {
_onHandlerStateChange = (event) => {
if (event.nativeEvent.state === State.ACTIVE) {
Alert.alert("I'm being pressed for so long");
this.setState({
lastGH: 'Long press',
});
}
};
_onSingleTap = event => {
_onSingleTap = (event) => {
if (event.nativeEvent.state === State.ACTIVE) {
Alert.alert("I'm touched");
this.setState({
lastGH: 'Single tap',
});
}
};
_onDoubleTap = event => {
_onDoubleTap = (event) => {
if (event.nativeEvent.state === State.ACTIVE) {
Alert.alert('Double tap, good job!');
this.setState({
Expand Down
2 changes: 1 addition & 1 deletion docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ console.log(versions);
const allDocHomesPaths = [
'/docs/next/',
'/docs/',
...versions.slice(1).map(version => `/docs/${version}/`),
...versions.slice(1).map((version) => `/docs/${version}/`),
];

const baseUrl = process.env.BASE_URL || '/';
Expand Down
2 changes: 1 addition & 1 deletion examples/Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@babel/runtime": "^7.12.5",
"@expo/webpack-config": "^0.12.52",
"@types/jest": "^25.2.3",
"@types/react-native": "^0.63.44",
"@types/react-native": "^0.63.49",
"@types/react-test-renderer": "^16.9.2",
"@typescript-eslint/parser": "^4.9.1",
"babel-jest": "^25.1.0",
Expand Down
8 changes: 4 additions & 4 deletions examples/Example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2188,10 +2188,10 @@
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.4.tgz#15925414e0ad2cd765bfef58842f7e26a7accb24"
integrity sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==

"@types/react-native@^0.63.44":
version "0.63.44"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.63.44.tgz#cd8df1bb6b2764b47afc1e643d20fb503dbfc52d"
integrity sha512-zTb6/mTehBtTBouFEvYzLv4rY+p1ujFVB+biO6KRaXQ+8rDeRabtvYVLf8ScZUL3qnahn38vHbcE6P63FneqOg==
"@types/react-native@^0.63.49":
version "0.63.49"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.63.49.tgz#b9a4781a0543763f0079c3ef2ba2148a4509b32e"
integrity sha512-ivTn2n9xsmlwSO1GygkwEMjkrSDqPAJVhbhsl3EffGtG6zWPaJ+AJVImPoBZN1VY8GItGPPlLGEb0i6LGb83VA==
dependencies:
"@types/react" "*"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@types/hoist-non-react-statics": "^3.3.1",
"@types/jest": "^26.0.19",
"@types/react": "^17.0.0",
"@types/react-native": "^0.63.44",
"@types/react-native": "^0.63.49",
"@types/react-test-renderer": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.10.0",
"@typescript-eslint/parser": "^4.10.0",
Expand Down
5 changes: 3 additions & 2 deletions src/PlatformConstants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { NativeModules } from 'react-native';
import { NativeModules, Platform } from 'react-native';

type PlatformConstants = {
forceTouchAvailable: boolean;
};

export default NativeModules.PlatformConstants as PlatformConstants;
export default (NativeModules?.PlatformConstants ??
Platform.constants) as PlatformConstants;
20 changes: 9 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2206,15 +2206,16 @@
"@types/prop-types@*":
version "15.7.3"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7"
integrity sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==

"@types/qs@^6.5.1":
version "6.9.3"
resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.3.tgz#b755a0934564a200d3efdf88546ec93c369abd03"

"@types/react-native@^0.63.44":
version "0.63.44"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.63.44.tgz#cd8df1bb6b2764b47afc1e643d20fb503dbfc52d"
integrity sha512-zTb6/mTehBtTBouFEvYzLv4rY+p1ujFVB+biO6KRaXQ+8rDeRabtvYVLf8ScZUL3qnahn38vHbcE6P63FneqOg==
"@types/react-native@^0.63.49":
version "0.63.49"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.63.49.tgz#b9a4781a0543763f0079c3ef2ba2148a4509b32e"
integrity sha512-ivTn2n9xsmlwSO1GygkwEMjkrSDqPAJVhbhsl3EffGtG6zWPaJ+AJVImPoBZN1VY8GItGPPlLGEb0i6LGb83VA==
dependencies:
"@types/react" "*"

Expand All @@ -2226,11 +2227,12 @@
"@types/react" "*"

"@types/react@*":
version "16.9.43"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.43.tgz#c287f23f6189666ee3bebc2eb8d0f84bcb6cdb6b"
version "17.0.2"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.2.tgz#3de24c4efef902dd9795a49c75f760cbe4f7a5a8"
integrity sha512-Xt40xQsrkdvjn1EyWe1Bc0dJLcil/9x2vAuW7ya+PuQip4UYUaXyhzWmAbwRsdMgwOFHpfp7/FFZebDU6Y8VHA==
dependencies:
"@types/prop-types" "*"
csstype "^2.2.0"
csstype "^3.0.2"

"@types/react@^17.0.0":
version "17.0.0"
Expand Down Expand Up @@ -3551,10 +3553,6 @@ cssstyle@^1.0.0:
dependencies:
cssom "0.3.x"

csstype@^2.2.0:
version "2.6.11"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.11.tgz#452f4d024149ecf260a852b025e36562a253ffc5"

csstype@^3.0.2:
version "3.0.5"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.5.tgz#7fdec6a28a67ae18647c51668a9ff95bb2fa7bb8"
Expand Down