Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/EnterLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DEFAULT } from './common';
import NumbersPanel from './components/NumbersPanel';
import Pin from './components/Pin';

const EnterLayout = ({ pin, styles, mode, textOptions, options, onSwitchMode, onEnter, onReset, onMaxAttempt }: {
const EnterLayout = ({ pin, styles, mode, textOptions, options, onSwitchMode, onEnter, onReset, onMaxAttempt, pinColor = 'white' }: {
pin: string | undefined;
styles?: PinCodeT.EnterStyles;
mode: PinCodeT.Modes;
Expand All @@ -15,6 +15,7 @@ const EnterLayout = ({ pin, styles, mode, textOptions, options, onSwitchMode, on
onEnter: (newPin: string) => void;
onMaxAttempt: () => void;
onReset: () => void;
pinColor?: string;
}) => {
const [curPin, setCurPin] = useState('');
const [disabled, disableButtons] = useState(false);
Expand Down Expand Up @@ -73,8 +74,8 @@ const EnterLayout = ({ pin, styles, mode, textOptions, options, onSwitchMode, on
<View style={[DEFAULT.Styles.enter?.content, styles?.content]}>
<Pin pin={curPin} pinLength={options?.pinLength || DEFAULT.Options.pinLength || 4}
style={styles?.pinContainer}
pinStyle={[DEFAULT.Styles.enter?.pin, styles?.pin]}
enteredPinStyle={[DEFAULT.Styles.enter?.enteredPin, styles?.enteredPin]} />
pinStyle={[DEFAULT.Styles.enter?.pin, styles?.pin, { backgroundColor: pinColor }]}
enteredPinStyle={[DEFAULT.Styles.enter?.enteredPin, styles?.enteredPin, { backgroundColor: pinColor }]} />

<NumbersPanel disabled={disabled} onButtonPress={onNumberPress}
backSpace={options?.backSpace} backSpaceText={textOptions.enter?.backSpace}
Expand Down
5 changes: 4 additions & 1 deletion src/PinCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ const PinCode = ({
options,
textOptions,
styles,
pinColor = 'white',
onEnter,
onSet,
onSetCancel,
onReset,
onModeChanged
}: PinCodeT.PinCodeProps) => {
}: PinCodeT.PinCodeProps & { pinColor?: string }) => {
const [curMode, setCurMode] = useState<PinCodeT.Modes>(mode);
const [curOptions, setCurOptions] = useState<PinCodeT.Options>(DEFAULT.Options);
const [curTextOptions, setCurTextOptions] = useState<PinCodeT.TextOptions>(DEFAULT.TextOptions);
Expand Down Expand Up @@ -72,6 +73,7 @@ const PinCode = ({
onMaxAttempt={() => switchMode(PinCodeT.Modes.Locked)}
onReset={() => switchMode(PinCodeT.Modes.Reset)}
styles={styles?.enter}
pinColor={pinColor}
/>
}
{(curMode == PinCodeT.Modes.Set) &&
Expand All @@ -81,6 +83,7 @@ const PinCode = ({
onReset={() => switchMode(PinCodeT.Modes.Reset)}
onSetCancel={onSetCancel}
styles={styles?.enter}
pinColor={pinColor}
/>
}
{(curMode == PinCodeT.Modes.Locked) &&
Expand Down
7 changes: 4 additions & 3 deletions src/SetLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DEFAULT } from './common';
import NumberButtons from './components/NumbersPanel';
import Pin from './components/Pin';

const SetLayout = ({ pin, styles, mode, textOptions, options, onSwitchMode, onSet, onSetCancel, onReset }: {
const SetLayout = ({ pin, styles, mode, textOptions, options, onSwitchMode, onSet, onSetCancel, onReset, pinColor = 'white' }: {
pin: string | undefined;
styles?: PinCodeT.SetStyles;
mode: PinCodeT.Modes;
Expand All @@ -15,6 +15,7 @@ const SetLayout = ({ pin, styles, mode, textOptions, options, onSwitchMode, onSe
onSetCancel?: () => void;
onSet: (newPin: string) => void;
onReset: () => void;
pinColor?: string;
}) => {
const [curPin, setCurPin] = useState('');
const [lastPin, setLastPin] = useState('');
Expand Down Expand Up @@ -69,8 +70,8 @@ const SetLayout = ({ pin, styles, mode, textOptions, options, onSwitchMode, onSe
<View style={[DEFAULT.Styles.enter?.content, styles?.content]}>
<Pin pin={curPin} pinLength={options?.pinLength || DEFAULT.Options.pinLength || 4}
style={styles?.pinContainer}
pinStyle={[DEFAULT.Styles.set?.pin, styles?.pin]}
enteredPinStyle={[DEFAULT.Styles.set?.enteredPin, styles?.enteredPin]} />
pinStyle={[DEFAULT.Styles.set?.pin, styles?.pin, { backgroundColor: pinColor }]}
enteredPinStyle={[DEFAULT.Styles.set?.enteredPin, styles?.enteredPin, { backgroundColor: pinColor }]} />

<NumberButtons onButtonPress={onNumberPress}
backSpace={options?.backSpace} backSpaceText={textOptions.enter?.backSpace}
Expand Down