Skip to content

Commit

Permalink
feat(rn): update root siblings (NervJS#11293)
Browse files Browse the repository at this point in the history
* feat: update feat-update-root-siblings version

* feat: add RootSiblingParent to root component

Co-authored-by: iChengbo <[email protected]>
  • Loading branch information
zhiqingchen and iChengbo authored Feb 17, 2022
1 parent e67b204 commit 8b8caf6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/taro-rn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"react-native-device-info": "~8.4.8",
"react-native-image-resizer": "~1.4.5",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-root-siblings": "^3.1.0",
"react-native-root-siblings": "^4.1.1",
"react-native-root-toast": "^3.0.1",
"react-native-safe-area-context": "~3.3.2",
"react-native-stylekit": "^1.0.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-runtime-rn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
},
"dependencies": {
"@tarojs/components-rn": "3.4.1",
"@tarojs/router-rn": "3.4.1"
"@tarojs/router-rn": "3.4.1",
"react-native-root-siblings": "^4.1.1"
},
"resolutions": {
"@types/react": "17.0.11"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react'
import { createRouter, RouterConfig } from '@tarojs/router-rn'
import { Provider as TCNProvider } from '@tarojs/components-rn'
import { RootSiblingParent } from 'react-native-root-siblings'
import { Current } from './current'
import { RNAppConfig } from './types/index'
import { AppInstance } from './instance'
Expand Down Expand Up @@ -35,15 +36,19 @@ export function createReactNativeApp (component: React.ComponentClass, config: R
props = { ref }
}
const { initPath = '', initParams = {} } = this.props
const appProps = {
...props,
...this.props
}
routerConfig.initPath = initPath
routerConfig.initParams = initParams
return React.createElement(TCNProvider, { ...this.props },
React.createElement(AppCompoent, {
...props,
...this.props
},
createRouter(routerConfig)
))
return <RootSiblingParent>
<TCNProvider {...this.props}>
<AppCompoent {...appProps}>
{createRouter(routerConfig)}
</AppCompoent>
</TCNProvider>
</RootSiblingParent>
}
}
}
Expand Down
15 changes: 1 addition & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26909,15 +26909,7 @@ react-native-pager-view@~5.4.9:
resolved "https://registry.yarnpkg.com/react-native-pager-view/-/react-native-pager-view-5.4.9.tgz#c0d40847cfeda5a4e729b53271b0ee0fedff3eb5"
integrity sha512-D6tzxpwMGdl6CXgtskGWhKRc5cJakCazESRGt7PkqnpyiH3N35ft1KmR82pCSQetAFlytFiToeu3a/dG5CELvA==

react-native-root-siblings@^3.1.0:
version "3.2.3"
resolved "https://registry.yarnpkg.com/react-native-root-siblings/-/react-native-root-siblings-3.2.3.tgz#df5a1cff3a3a1f433f57320e1cae719f1b15a3f2"
integrity sha512-wOCCtKJteaSIW3K++hzhkfdWRikTqjrG34DnhNDVSzKatuNQyFY1fPBD1YFT/3+kxOIUmNsJdiaPMao9QgoZMA==
dependencies:
prop-types "^15.6.2"
static-container "^1.0.0"

react-native-root-siblings@^4.0.0:
react-native-root-siblings@^4.0.0, react-native-root-siblings@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/react-native-root-siblings/-/react-native-root-siblings-4.1.1.tgz#b7742db7634a87f507eb99a5fd699c4f10c46ab0"
integrity sha512-sdmLElNs5PDWqmZmj4/aNH4anyxreaPm61c4ZkRiR8SO/GzLg6KjAbb0e17RmMdnBdD0AIQbS38h/l55YKN4ZA==
Expand Down Expand Up @@ -29236,11 +29228,6 @@ stacktrace-parser@^0.1.3:
dependencies:
type-fest "^0.7.1"

static-container@^1.0.0:
version "1.7.1"
resolved "https://registry.yarnpkg.com/static-container/-/static-container-1.7.1.tgz#2391d137255f1cd5db47ab3970c4aa277031dedf"
integrity sha512-rsUMpoUZ4sHsFyy+Wp9Kqnv3HU+LD5ShPRd+ocg8US9juKckq+7VgDEK+ZbG8sQ1EOaw2LBpF8XLwpozqGHGBQ==

static-extend@^0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6"
Expand Down

0 comments on commit 8b8caf6

Please sign in to comment.