以下是我的应用程序导航器的层次结构
???appNavigator(底部标签导航器)
???提要(堆栈导航器)
???通知(堆栈导航器)
???个人资料(堆栈导航器)
现在的问题是我必须复制所有堆栈中通用的屏幕(ProfileDetail、PostDetail 和 PageDetail),以便在堆栈中访问它们。
对于此用例,是否有更好的解决方案。我应该在哪里放置通用屏幕,以便它们在所有子堆栈中可用,并且我不必在任何地方复制它们。
这是我经历的一个开放的 github 问题,但找不到好的解决方案 Isuue
reactjs react-native react-navigation react-navigation-stack react-navigation-v5
我使用样式组件已经有一段时间了,但说实话,我从来没有真正理解它是如何工作的。这就是我的问题所在。
所以,我理解样式组件可以根据道具进行调整。我不明白的是道具的转发是如何工作的。
例如,就我而言,我正在使用 React Native。我为输入字段提供了一些默认道具。现在,样式化组件包装器会自动拾取默认高度道具,但如果我显式传递该道具,它不会拾取它,我必须手动从道具中获取它。那是关于什么的?
import React from "react";
import styled from "styled-components/native";
const StyledTextInput = styled.TextInput`
/* Why do I have to do this for custom heights.
* Isn't height automatically get forwarded?
*/
/* if I comment this height style out, It takes defaultProp height but doesn't take custom height
* I have to uncomment it for the custom height
*/
height: ${({ height }) => height};
...other styles
`;
const TextInput = ({ height }) => { …
Run Code Online (Sandbox Code Playgroud) .test.ts
过去三天我一直在尝试修复文件的此错误。
我有我tsconfig
的如下
{
"compilerOptions": {
"target": "es6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"lib": ["ESNext"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"module": "commonjs", /* Specify what module code is generated. */
"rootDir": "./src", /* Specify the root folder within your source files. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. …
Run Code Online (Sandbox Code Playgroud) 所以我嵌套了导航器
Main BottomTab.Navigator
问题是当我从 Profile View Screen 导航到 Follow Navigator 时,我将一些参数传递给了父 Follow Navigator,并且我希望所有这些参数都在子选项卡屏幕(页面/组)中。
但是子选项卡屏幕的路由没有获取传递给父导航器的参数(以下选项卡导航器)
有没有办法做到这一点?
这是我的代码: 配置文件堆栈
const ProfileStack = () => (
<Stack.Navigator
initialRouteName='profileView'
>
<Stack.Screen
name='profileView'
component={ProfileScreen}
options={{
headerMode: 'screen',
headerShown: false,
}}
/>
<Stack.Screen
name='followers'
component={FollowersScreen}
options={{
headerTitle: 'Followers',
}}
/>
<Stack.Screen
name='following'
component={FollowingTabs}
options={{
headerTitle: 'Following',
}}
/>
</Stack.Navigator>
Run Code Online (Sandbox Code Playgroud)
跟随标签
const Tabs = createMaterialTopTabNavigator();
export const FollowingTabs …
Run Code Online (Sandbox Code Playgroud) javascript reactjs react-native react-navigation react-navigation-v5
这可能是一件很小的事情。我注意到有人在互联网上打字,-B
而不是-b
在切换到新分支时打字。
git checkout -B new_branch
Run Code Online (Sandbox Code Playgroud)
这意味着什么?我们什么时候使用大写 B。如果-D
我们用大写 D 标志强制删除。资本 B 会发生什么?
Force deletion:
git branch -D local_branch
Run Code Online (Sandbox Code Playgroud)
我尝试查看这些很棒的git Flight Rules,但没有找到任何内容。
任何帮助,将不胜感激。
react-native ×3
reactjs ×3
javascript ×2
eslint ×1
git ×1
github ×1
gitlab ×1
node.js ×1
typescript ×1