-
Notifications
You must be signed in to change notification settings - Fork 0
feat: added example app to support rn0.83 #10
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
sunitaprajapati89
wants to merge
3
commits into
main
Choose a base branch
from
update-to-vega0.24-rn0.83
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 hidden or 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 |
|---|---|---|
|
|
@@ -102,3 +102,4 @@ packages/core/src/info.ts | |
| dist | ||
| buildinfo.json | ||
| CMakeUserPresets.json | ||
| .npmrc | ||
This file contains hidden or 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 hidden or 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,3 +1,3 @@ | ||
| module.exports = { | ||
| presets: ['module:metro-react-native-babel-preset'], | ||
| presets: ['module:@react-native/babel-preset'], | ||
| }; |
This file contains hidden or 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,11 @@ | ||
| { | ||
| "extends": [ | ||
| "@react-native", | ||
| "eslint:recommended" | ||
| ], | ||
| "plugins": ["@typescript-eslint"], | ||
| "parserOptions": { | ||
| "project": "./tsconfig.json" | ||
| }, | ||
| "parser": "@typescript-eslint/parser" | ||
| } |
This file contains hidden or 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,13 @@ | ||
| *.iml | ||
| *.swp | ||
| .idea | ||
| .DS_Store | ||
| .vscode | ||
| .tmp | ||
|
|
||
| dist | ||
| build | ||
| node_modules | ||
| buildinfo.json | ||
| CMakeUserPresets.json | ||
| npm-debug.log |
This file contains hidden or 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,2 @@ | ||
| [tools] | ||
| node = "18" | ||
This file contains hidden or 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 @@ | ||
| { | ||
| "bracketSameLine": true, | ||
| "bracketSpacing": false, | ||
| "singleQuote": true, | ||
| "trailingComma": "all", | ||
| "tabWidth": 2 | ||
| } |
15 changes: 15 additions & 0 deletions
15
example-83/analytics-react-native-plugin-kepler.code-workspace
This file contains hidden or 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,15 @@ | ||
| { | ||
| "folders": [ | ||
| { | ||
| "path": ".." | ||
| }, | ||
| { | ||
| "path": "." | ||
| } | ||
| ], | ||
| "settings": { | ||
| "C_Cpp.default.includePath": [ | ||
| "${workspaceFolder}/**" | ||
| ] | ||
| } | ||
| } |
This file contains hidden or 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,5 @@ | ||
| { | ||
| "//": "The declared app name must follow this pattern to be KRL-compatible", | ||
| "name": "com.segment.keplersample83.main", | ||
| "displayName": "AmazonKepler83" | ||
| } |
This file contains hidden or 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,8 @@ | ||
| /* | ||
| * Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All rights reserved. | ||
| * | ||
| * PROPRIETARY/CONFIDENTIAL. USE IS SUBJECT TO LICENSE TERMS. | ||
| */ | ||
| module.exports = { | ||
| presets: ['module:@react-native/babel-preset'], | ||
| }; |
This file contains hidden or 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,15 @@ | ||
| /* | ||
| * Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All rights reserved. | ||
| * | ||
| * PROPRIETARY/CONFIDENTIAL. USE IS SUBJECT TO LICENSE TERMS. | ||
| */ | ||
|
|
||
| import { AppRegistry, LogBox } from 'react-native'; | ||
| import { App } from './src/App'; | ||
| import { name as appName } from './app.json'; | ||
|
|
||
| // Temporary workaround for problem with nested text | ||
| // not working currently. | ||
| LogBox.ignoreAllLogs(); | ||
|
|
||
| AppRegistry.registerComponent(appName, () => App); |
This file contains hidden or 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,35 @@ | ||
| { | ||
| "preset": "react-native", | ||
| "transform": { | ||
| "^.+\\.tsx?$": "ts-jest" | ||
| }, | ||
| "testRegex": "/tst/.*\\.(test|spec)\\.(ts|tsx|js)$", | ||
| "moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"], | ||
| "moduleNameMapper": { | ||
| "^~/(.*)$": "<rootDir>/src/$1" | ||
| }, | ||
| "modulePaths": ["<rootDir>/src"], | ||
| "roots": [ | ||
| "<rootDir>/src/", | ||
| "<rootDir>/tst/", | ||
| "<rootDir>/node_modules/" | ||
| ], | ||
| "collectCoverage": false, | ||
| "coverageReporters": ["json", "json-summary", "lcov", "text"], | ||
| "collectCoverageFrom": [ | ||
| "src/**/*", | ||
| "!**/index.{ts,js,tsx}", | ||
| "!**/types.ts", | ||
| "!src/**/*.d.ts" | ||
| ], | ||
| "transformIgnorePatterns": [ | ||
| "node_modules/(?!(@amazon-devices|react-native|@react-native|@react-native-async-storage)/)" | ||
| ], | ||
| "coverageDirectory": ".tmp/coverage", | ||
| "globals": { | ||
| "ts-jest": { | ||
| "babelConfig": true, | ||
| "diagnostics": true | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,18 @@ | ||
| # | ||
| # Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All rights reserved. | ||
| # | ||
| # PROPRIETARY/CONFIDENTIAL. USE IS SUBJECT TO LICENSE TERMS. | ||
| # | ||
| schema-version = 1 | ||
|
|
||
| [package] | ||
| title = "Basic UI React Native Application" | ||
| version = "0.1.0" | ||
| id = "com.segment.keplersample83" | ||
|
|
||
| [components] | ||
| [[components.interactive]] | ||
| id = "com.segment.keplersample83.main" | ||
| runtime-module = "/com.amazon.kepler.runtime.react_native_kepler_4@IReactNativeKepler_0" | ||
| categories = ["com.amazon.category.main"] | ||
| launch-type = "singleton" |
This file contains hidden or 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,78 @@ | ||
| /* | ||
| * Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All rights reserved. | ||
| * | ||
| * PROPRIETARY/CONFIDENTIAL. USE IS SUBJECT TO LICENSE TERMS. | ||
| */ | ||
|
|
||
| const path = require('path'); | ||
| const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config'); | ||
|
|
||
| /** | ||
| * Metro configuration | ||
| * https://facebook.github.io/metro/docs/configuration | ||
| * | ||
| * @type {import('metro-config').MetroConfig} | ||
| */ | ||
| const defaultConfig = getDefaultConfig(__dirname); | ||
|
|
||
| // Capture Kepler's resolveRequest before merging — it remaps `react-native` | ||
| // to the @amzn/react-native-kepler system bundle. Must chain to it. | ||
| const keplerResolveRequest = defaultConfig.resolver?.resolveRequest; | ||
|
|
||
| const config = { | ||
| resolver: { | ||
| platforms: [...(defaultConfig.resolver?.platforms ?? []), 'kepler'], | ||
| extraNodeModules: { | ||
| // @amazon-devices/react-native-kepler still embeds @amzn/* source refs | ||
| // internally; alias the old name so Metro resolves assets correctly. | ||
| '@amzn/react-native-kepler': path.resolve( | ||
| __dirname, | ||
| 'node_modules/@amazon-devices/react-native-kepler', | ||
| ), | ||
| }, | ||
| resolveRequest: (context, moduleName, platform) => { | ||
| // react-native-get-random-values calls TurboModuleRegistry.getEnforcing | ||
| // for RNGetRandomValues which is not registered on Kepler 4. Replace with | ||
| // a pure-JS Math.random polyfill. | ||
| if (moduleName === 'react-native-get-random-values') { | ||
| return { | ||
| filePath: path.resolve(__dirname, 'src/get-random-values-polyfill.js'), | ||
| type: 'sourceFile', | ||
| }; | ||
| } | ||
| // @segment/sovran-react-native index.tsx accesses NativeModules which | ||
| // triggers Kepler's legacy BatchedBridge and crashes before any try/catch. | ||
| if (moduleName === '@segment/sovran-react-native' || | ||
| moduleName.endsWith('/sovran-react-native')) { | ||
| return { | ||
| filePath: path.resolve(__dirname, 'src/sovran-polyfill.js'), | ||
| type: 'sourceFile', | ||
| }; | ||
| } | ||
| // context.ts calls getNativeModule('AnalyticsReactNative') which also | ||
| // triggers NativeModules. Kepler plugin provides its own deviceInfoProvider | ||
| // so returning defaultContext here is safe. | ||
| // Match both absolute package path and relative imports (./context, ../context) | ||
| // from within the analytics-react-native package. | ||
| if (moduleName === '@segment/analytics-react-native/src/context' || | ||
| ((moduleName === './context' || moduleName.endsWith('/context')) && | ||
| context.originModulePath.includes('analytics-react-native'))) { | ||
| return { | ||
| filePath: path.resolve(__dirname, 'src/context-polyfill.js'), | ||
| type: 'sourceFile', | ||
| }; | ||
| } | ||
| if (keplerResolveRequest) { | ||
| return keplerResolveRequest(context, moduleName, platform); | ||
| } | ||
| return context.resolveRequest(context, moduleName, platform); | ||
| }, | ||
| }, | ||
| transformer: { | ||
| transformIgnorePatterns: [ | ||
| 'node_modules/(?!(@amazon-devices|@amzn|@segment|react-native|@react-native|@react-native-async-storage)/)', | ||
| ], | ||
| }, | ||
| }; | ||
|
|
||
| module.exports = mergeConfig(defaultConfig, config); |
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.
Node is pinned to 20 elsewhere, should this be updated?
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.
Checked the repo — the root .mise.toml and example/.mise.toml both pin Node 18, not 20. example-83/.mise.toml was already consistent at 18. No change needed here. If there's a specific place you're seeing 20, happy to align, but I don't see it in this repo.