diff --git a/example/src/examples/TextInputExample.tsx b/example/src/examples/TextInputExample.tsx index f857ee9..0e00bdf 100644 --- a/example/src/examples/TextInputExample.tsx +++ b/example/src/examples/TextInputExample.tsx @@ -1,42 +1,100 @@ import React from 'react'; -import { StyleSheet } from 'react-native'; -import { TextInput, Panel, Fieldset } from 'react95-native'; +import { View, StyleSheet } from 'react-native'; +import { TextInput, Panel, Fieldset, Cutout, ScrollView } from 'react95-native'; const loremIpsum = 'But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself'; const TextInputExample = () => { return ( -
- - -
-
- - -
-
- - -
+ + + +
+ + +
+
+ + +
+
+ + +
+ + +
+ + +
+
+ + +
+
+ + +
+
+
+
+
); }; @@ -44,7 +102,7 @@ const TextInputExample = () => { const styles = StyleSheet.create({ container: { flex: 1, - padding: 16, + padding: 8, }, fieldset: { padding: 20, diff --git a/src/TextInput/TextInput.tsx b/src/TextInput/TextInput.tsx index 8eb88f0..31f9c23 100644 --- a/src/TextInput/TextInput.tsx +++ b/src/TextInput/TextInput.tsx @@ -16,6 +16,7 @@ type Props = React.ComponentPropsWithRef & { defaultValue?: string; style?: StyleProp; disabled?: boolean; + variant?: 'default' | 'flat'; }; // TODO: implement scrollbars in TextInput @@ -23,6 +24,7 @@ type Props = React.ComponentPropsWithRef & { const TextInput = ({ disabled, value, + variant = 'default', defaultValue, style = {}, ...rest @@ -30,14 +32,23 @@ const TextInput = ({ const theme = useContext(ThemeContext); const hasValue = !!(value || defaultValue); + const isFlat = variant === 'flat'; + + const getBackgroundColor = () => { + if (isFlat) { + return disabled ? theme.flatLight : 'transparent'; + } + return disabled ? theme.material : theme.canvas; + }; + return ( - - + +