mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
1ea269f42c
Summary:
```tsx
import {Text} from 'react-native'
interface Props {
foregroundColor?: string | undefined | null
}
function Test({foregroundColor}: Props){
return <Text style=[styles.icon, foregroundColor && { color: foregroundColor }] />
// ^^^ Error: Type "" is not assignable to type TextStyle | Falsy | RegisteredStyle<TextStyle> | RecursiveArray<TextStyle...
}
```
## Changelog:
[GENERAL] [ADDED] - [TypeScript] Allow to pass empty string as style
Pull Request resolved: https://github.com/facebook/react-native/pull/43404
Test Plan:
Change `Falsy` type locally and test it on the next code
```tsx
const styles = StyleSheet.create({
text: {
color: 'red',
},
});
export const a = <Text style={[styles.text, null, '', undefined, false]} />;
```
Reviewed By: rshest
Differential Revision: D54744517
Pulled By: javache
fbshipit-source-id: c5b934616cc0501c2b6a7907e6be522187a2cc20