相关平台
React Native
使用框架: React
复现步骤
<View onLayout={...}>
<Text numberOfLines={1}>taro demo</Text>
</View>
期望结果
编码时提示,且注明是 RN 端属性
实际结果
不能
环境信息
👽 Taro v3.2.0-beta.2
Taro CLI 3.2.0-beta.2 environment info:
System:
OS: macOS 11.2
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.5.0 - ~/.nvm/versions/node/v16.5.0/bin/node
Yarn: 1.22.5 - ~/.yarn/bin/yarn
npm: 7.19.1 - ~/.nvm/versions/node/v16.5.0/bin/npm
npmPackages:
@tarojs/cli: 3.3.0 => 3.3.0
@tarojs/components: 3.3.0 => 3.3.0
@tarojs/mini-runner: 3.3.0 => 3.3.0
@tarojs/react: 3.3.0 => 3.3.0
@tarojs/runtime: 3.3.0 => 3.3.0
@tarojs/taro: 3.3.0 => 3.3.0
@tarojs/webpack-runner: 3.3.0 => 3.3.0
babel-preset-taro: 3.3.0 => 3.3.0
eslint-config-taro: 3.3.0 => 3.3.0
react: ^17.0.0 => 17.0.2
react-native: ^0.64.0 => 0.64.2
补充信息
方案1:(缺点-不能在编码时注明是 RN 端独有属性)
- packages/taro-components/types/View.d.ts
import { StyleProp, ViewStyle, ViewProps as RNViewProps } from 'react-native'
type CombinedProps = StandardProps & RNViewProps
interface ViewProps extends CombinedProps {
...
}
- packages/taro-components/types/Text.d.ts
import { TextProps as RNTextProps } from 'react-native'
type CombinedProps = StandardProps & RNTextProps
interface TextProps extends CombinedProps {
...
}
1条答案
按热度按时间drnojrws1#
提供RN版本的global type?