From 011cbb831e2da5d81244ce79e603734becf9fea7 Mon Sep 17 00:00:00 2001 From: budiadiono Date: Tue, 25 Sep 2018 08:07:57 +0700 Subject: [PATCH] use StyleProp for all style props --- src/Calculator.tsx | 10 ++++++++-- src/CalculatorInput.tsx | 7 ++++--- src/Display.tsx | 5 ++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Calculator.tsx b/src/Calculator.tsx index 5967e58..8b8b433 100644 --- a/src/Calculator.tsx +++ b/src/Calculator.tsx @@ -1,5 +1,11 @@ import * as React from 'react' -import { LayoutRectangle, StyleSheet, View, ViewStyle } from 'react-native' +import { + LayoutRectangle, + StyleProp, + StyleSheet, + View, + ViewStyle +} from 'react-native' import { Button } from './Button' import { Display } from './Display' import { CalculatorCommonProps, DefaultCommonProps } from './interface' @@ -29,7 +35,7 @@ export interface CalculatorProps extends CalculatorCommonProps { /** * Container style. */ - style?: ViewStyle + style?: StyleProp /** * Calculate button click event. diff --git a/src/CalculatorInput.tsx b/src/CalculatorInput.tsx index bc0eeec..ddf752d 100644 --- a/src/CalculatorInput.tsx +++ b/src/CalculatorInput.tsx @@ -2,6 +2,7 @@ import * as React from 'react' import { Dimensions, Modal, + StyleProp, StyleSheet, Text, TextStyle, @@ -38,17 +39,17 @@ export interface CalculatorInputProps extends CalculatorCommonProps { /** * Style of modal backdrop. */ - modalBackdropStyle?: ViewStyle + modalBackdropStyle?: StyleProp /** * Text field container style. */ - fieldContainerStyle?: ViewStyle + fieldContainerStyle?: StyleProp /** * Text style. */ - fieldTextStyle?: TextStyle + fieldTextStyle?: StyleProp /** * Prefix text. diff --git a/src/Display.tsx b/src/Display.tsx index e232a7e..07c9773 100644 --- a/src/Display.tsx +++ b/src/Display.tsx @@ -3,6 +3,7 @@ import { findNodeHandle, NativeModules, Platform, + StyleProp, StyleSheet, Text, TextStyle, @@ -24,7 +25,7 @@ export interface DisplayProps { height: number width: number value: string - style: TextStyle + style: StyleProp } export class Display extends React.Component { @@ -132,6 +133,7 @@ export class Display extends React.Component { fontSize: height, height, lineHeight: height, + // @ts-ignore color: style.color } ]} @@ -163,6 +165,7 @@ export class Display extends React.Component { fontSize: fixSize, height, top: (height - fontHeight) / 2, + // @ts-ignore color: ready ? style.color : 'transparent' } ]}