-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create an up to date example project targeting React Native 0.64
- Loading branch information
1 parent
c25bfae
commit 1ede470
Showing
70 changed files
with
8,869 additions
and
1,536 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Windows files | ||
[*.bat] | ||
end_of_line = crlf |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
root: true, | ||
extends: '@react-native-community', | ||
}; |
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,58 +1,66 @@ | ||
[ignore] | ||
|
||
# We fork some components by platform. | ||
; We fork some components by platform | ||
.*/*[.]android.js | ||
|
||
# Ignore templates with `@flow` in header | ||
.*/local-cli/generator.* | ||
|
||
# Ignore malformed json | ||
.*/node_modules/y18n/test/.*\.json | ||
|
||
# Ignore the website subdir | ||
<PROJECT_ROOT>/website/.* | ||
|
||
# Ignore BUCK generated dirs | ||
; Ignore "BUCK" generated dirs | ||
<PROJECT_ROOT>/\.buckd/ | ||
|
||
# Ignore unexpected extra @providesModule | ||
.*/node_modules/commoner/test/source/widget/share.js | ||
; Ignore polyfills | ||
node_modules/react-native/Libraries/polyfills/.* | ||
|
||
# Ignore duplicate module providers | ||
# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root | ||
.*/Libraries/react-native/React.js | ||
.*/Libraries/react-native/ReactNative.js | ||
.*/node_modules/jest-runtime/build/__tests__/.* | ||
; Flow doesn't support platforms | ||
.*/Libraries/Utilities/LoadingView.js | ||
|
||
[untyped] | ||
.*/node_modules/@react-native-community/cli/.*/.* | ||
|
||
[include] | ||
|
||
[libs] | ||
node_modules/react-native/Libraries/react-native/react-native-interface.js | ||
node_modules/react-native/flow | ||
flow/ | ||
node_modules/react-native/interface.js | ||
node_modules/react-native/flow/ | ||
|
||
[options] | ||
module.system=haste | ||
emoji=true | ||
|
||
esproposal.optional_chaining=enable | ||
esproposal.nullish_coalescing=enable | ||
|
||
esproposal.class_static_fields=enable | ||
esproposal.class_instance_fields=enable | ||
exact_by_default=true | ||
|
||
experimental.strict_type_args=true | ||
module.file_ext=.js | ||
module.file_ext=.json | ||
module.file_ext=.ios.js | ||
|
||
munge_underscores=true | ||
|
||
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' | ||
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' | ||
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1' | ||
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub' | ||
|
||
suppress_type=$FlowIssue | ||
suppress_type=$FlowFixMe | ||
suppress_type=$FixMe | ||
|
||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-2]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) | ||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-2]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ | ||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy | ||
|
||
unsafe.enable_getters_and_setters=true | ||
suppress_type=$FlowFixMeProps | ||
suppress_type=$FlowFixMeState | ||
|
||
[lints] | ||
sketchy-null-number=warn | ||
sketchy-null-mixed=warn | ||
sketchy-number=warn | ||
untyped-type-import=warn | ||
nonstrict-import=warn | ||
deprecated-type=warn | ||
unsafe-getters-setters=warn | ||
unnecessary-invariant=warn | ||
signature-verification-failure=warn | ||
|
||
[strict] | ||
deprecated-type | ||
nonstrict-import | ||
sketchy-null | ||
unclear-type | ||
unsafe-getters-setters | ||
untyped-import | ||
untyped-type-import | ||
|
||
[version] | ||
^0.32.0 | ||
^0.137.0 |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Windows files should use crlf line endings | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
*.bat text eol=crlf |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
bracketSpacing: false, | ||
jsxBracketSameLine: true, | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
arrowParens: 'avoid', | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/** | ||
* Sample React Native App | ||
* https://github.com/facebook/react-native | ||
* | ||
* @format | ||
* @flow strict-local | ||
*/ | ||
|
||
import * as React from 'react'; | ||
import {SafeAreaView, ScrollView, View, StyleSheet, Text} from 'react-native'; | ||
import JailMonkey from 'jail-monkey'; | ||
|
||
/* | ||
const JailMonkey: { | ||
isJailBroken: () => boolean; | ||
hookDetected: () => boolean; | ||
isDebuggedMode: () => Promise<boolean>; | ||
canMockLocation: () => boolean; | ||
trustFall: () => boolean; | ||
isOnExternalStorage: () => boolean; | ||
AdbEnabled: () => boolean; | ||
isDevelopmentSettingsMode: () => Promise<boolean>; | ||
} | ||
*/ | ||
|
||
export default function App() { | ||
const [isDevelopmentSettingsMode, setIsDevelopmentSettingsMode] = | ||
React.useState(); | ||
const [isDebuggedMode, setIsDebuggedMode] = React.useState(); | ||
|
||
React.useEffect(() => { | ||
JailMonkey.isDevelopmentSettingsMode() | ||
.then(value => { | ||
setIsDevelopmentSettingsMode(value); | ||
}) | ||
.catch(console.warn); | ||
}, []); | ||
|
||
React.useEffect(() => { | ||
JailMonkey.isDebuggedMode() | ||
.then(value => { | ||
setIsDebuggedMode(value); | ||
}) | ||
.catch(console.warn); | ||
}, []); | ||
|
||
return ( | ||
<SafeAreaView style={styles.root}> | ||
<View style={styles.content} accessible={false} accessibilityLabel=""> | ||
<Row label="isJailBroken" value={JailMonkey.isJailBroken()} /> | ||
<Row label="canMockLocation" value={JailMonkey.canMockLocation()} /> | ||
<Row label="trustFall" value={JailMonkey.trustFall()} /> | ||
<Row label="hookDetected" value={JailMonkey.hookDetected()} /> | ||
<Row | ||
label="isOnExternalStorage" | ||
value={JailMonkey.isOnExternalStorage()} | ||
/> | ||
<Row label="AdbEnabled" value={JailMonkey.AdbEnabled()} /> | ||
<Row | ||
label="isDevelopmentSettingsMode" | ||
value={isDevelopmentSettingsMode} | ||
/> | ||
<Row label="isDebuggedMode" value={isDebuggedMode} /> | ||
</View> | ||
</SafeAreaView> | ||
); | ||
} | ||
|
||
function Row({label, value}) { | ||
return ( | ||
<View | ||
style={styles.row} | ||
accessibilityLabel={`${label}: ${value?.toString() ?? 'unknown'}`}> | ||
<Text style={styles.label}>{label}:</Text> | ||
<Text style={styles.value}>{value?.toString() ?? 'unknown'}</Text> | ||
</View> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
root: { | ||
flex: 1, | ||
}, | ||
content: { | ||
padding: 20, | ||
}, | ||
row: { | ||
flexDirection: 'row', | ||
marginBottom: 5, | ||
}, | ||
label: { | ||
fontSize: 16, | ||
color: 'black', | ||
fontWeight: '700', | ||
marginRight: 10, | ||
}, | ||
value: { | ||
fontSize: 16, | ||
color: 'black', | ||
}, | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @format | ||
*/ | ||
|
||
import 'react-native'; | ||
import React from 'react'; | ||
import App from '../App'; | ||
|
||
// Note: test renderer must be required after react-native. | ||
import renderer from 'react-test-renderer'; | ||
|
||
it('renders correctly', () => { | ||
renderer.create(<App />); | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.