看起来 Expo Webpack 没有optional chaining。
当我尝试将UI Kitten安装到 Expo Web 应用程序时,我发现了这一点。
这是我将 UI Kitten 添加到新创建的 Expo 应用程序后的编译错误
node_modules/@ui-kitten/components/ui/input/input.component.js 104:38
Module parse failed: Unexpected token (104:38)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| this.webEventResponder = devsupport_1.WebEventResponder.create(this);
| this.focus = () => {
> this.textInputRef.current?.focus();
| };
| this.blur = () => {
Run Code Online (Sandbox Code Playgroud)
Deps 版本(我在这里写的那一刻的最新版本。)
expo@37.0.6@ui-kitten/components@5.0.0-alpha.1 有什么技巧可以解决这个问题?
javascript optional-chaining react-native-web expo react-native-ui-kitten
我在我的应用程序中使用Formik和yup作为表单。我无法使用Formik实现复选框,实现了这个解决方案,但它不适合我。以下是我迄今为止尝试过的代码。在我单击复选框时实施此解决方案后,表单变得无效并且提交按钮不会调用方法。我也尝试使用而不是,但结果是一样的。handleSubmitReact Native ElementsUI Kitten
const validationSchema = Yup.object().shape({
service_charge_status: Yup.boolean(),//.oneOf([true], 'Please check the agreement'),
documents_status: Yup.boolean(), //.oneOf([true], 'Please check the agreement'),
security_number: Yup.string()
.label('Security Number *')
.required('Security Number is required'),
note: Yup.string().label('Note')
})
handleSubmit = (values: any) => {
console.log('AD Values', values);
}
render() {
return (
<Formik
initialValues={{
// id: '',
service_charge_status: false,
documents_status: false,
security_number: '',
note: '',
security_personel_number: ''
}}
onSubmit={values => { this.handleSubmit(values) …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 typescript 4.1.2 在我的 React Native 应用程序中配置react-i18next 11.8.2:
i18n.use(initReactI18next).init({
resources: {
en,
es,
},
lng: 'es',
fallbackLng: 'es',
interpolation: {
escapeValue: false,
},
});
Run Code Online (Sandbox Code Playgroud)
有两个资源文件(en,es)。
但我在使用 useTranslation 挂钩的 TFunction 接口中遇到打字稿错误:
const {t, i18n} = useTranslation(['SelectLanguage']);]
<StyledLabel>{t('SelectLanguage:title')}</StyledLabel>
Run Code Online (Sandbox Code Playgroud)
错误:
No overload matches this call.
Overload 1 of 2, '(props: Pick<Pick<TextProps & RefAttributes<Text>, "key" | "ref" | "style" | "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | ... 35 more ... | "dataDetectorType"> & Partial<...>, "key" | ... 42 more ... …Run Code Online (Sandbox Code Playgroud) internationalization typescript react-native react-i18next react-native-ui-kitten
我试图在 UI Kitten 中使用 Eva 图标,但最终得到了这个错误,我在这个问题上挖了一段时间,React 和 Reavt-Native 的新手,如果有人能帮助我,我会很高兴(:
render()
const FacebookIcon = (props) => (
<Icon name='facebook' {...props} />
);
return(
<Input
value={this.state.id}
label="FB ID"
size="medium"
placeholder="Enter your fb_id"
onChangeText={(enteredText) => this.setState({ fbId: enteredText })}
accessoryLeft={FacebookIcon}
/>
)
Run Code Online (Sandbox Code Playgroud) <Layout>
<BottomNavigation indicatorStyle={styles.tabIndicator} selectedIndex={selectIndex} onSelect={onSelect} >
<BottomNavigationTab title='Home' icon={homeIcon}/>
<BottomNavigationTab title='Cart' icon={cartIcon}/>
<BottomNavigationTab title='Search' icon={searchIcon}/>
<BottomNavigationTab title='Account' icon={accountIcon}/>
<BottomNavigationTab title='More' icon={menuIcon}/>
</BottomNavigation>
</Layout>
Run Code Online (Sandbox Code Playgroud)
如何更改 ui-kitten 库中选定选项卡项目以及未选定选项卡项目的图标颜色和文本颜色?
"@eva-design/eva": "^1.4.0",
"@react-native-community/masked-view": "^0.1.7",
"@ui-kitten/components": "^4.4.1",
"@ui-kitten/eva-icons": "^4.4.1",
"react": "16.9.0",
"react-native": "0.61.4",
Run Code Online (Sandbox Code Playgroud) 我正在为我的 React Native 应用程序 UI 使用 UI Kitten 库,当我添加他们的图标包时 Android 应用程序错误,iOS 工作正常。
安卓获取:
Attempt to invoke virtual method `int java.lang.Integer.intValue()` on a null object reference
Run Code Online (Sandbox Code Playgroud)
这App.tsx:
import {EvaIconsPack} from '@ui-kitten/eva-icons';
export default () => (
<>
<IconRegistry icons={EvaIconsPack} />
<ApplicationProvider {...eva} theme={{...eva.light, ...theme}}>
<Layout style={styles.layout}>
<Button accessoryLeft={<Icon name="facebook" />}>
Login with Facebook
</Button>
</Layout>
</ApplicationProvider>
</>
);
Run Code Online (Sandbox Code Playgroud)
这行是问题所在:
<Icon name="facebook" />
Run Code Online (Sandbox Code Playgroud)
当我删除它并保留Button原状时
<Button>
Login with Facebook
</Button>
Run Code Online (Sandbox Code Playgroud)
安卓又可以用了。
有任何想法吗?
我正在使用 expo sdk 47 托管工作流程并尝试使用 UI Kitten 框架构建项目 https://akveo.github.io/react-native-ui-kitten/
在 iOS 上一切正常。
在 Android 上,我遇到一个问题 Invariant Violation: requireNativeComponent: "RNSVGSvgViewAndroid" was not found in the UIManager。
试图找到解决方案但没有运气。
一切都重新安装了好几次。我有
“@ui-kitten/components”:“^5.1.2”,“expo”:“~47.0.8”,“react”:“18.1.0”,“react-native-svg”:“^13.6.0 “,
问题出在最新版本的 expo SDK 上。有什么想法如何修复吗?有人有同样的吗?
我只发现了这个新问题,但它与另一个库有关,并且解决方案对我不起作用。 不变违规:requireNativeComponent:在 UIManager 中找不到“RNSVGSvgViewAndroid”
还尝试了“react-native-svg”:“^13.4.0”,这是expo sdk47推荐的,但有另一个错误(https://github.com/software-mansion/react-native-svg/issues/1899)建议通过安装 13.5.0 来修复,但随后我收到初始错误。
花了几天时间找到解决方案后,我没有其他想法,只能在这里问。