一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
39 行
1.2 KiB
TypeScript
39 行
1.2 KiB
TypeScript
import * as React from 'react';
|
|
import { Ref, useMemo } from 'react';
|
|
import { themeStyle } from './global-style';
|
|
import { TextInput, TextInputProps, StyleSheet } from 'react-native';
|
|
|
|
interface Props extends TextInputProps {
|
|
ref?: Ref<TextInput>;
|
|
themeId: number;
|
|
}
|
|
|
|
export default (props: Props) => {
|
|
const theme = themeStyle(props.themeId);
|
|
const finalProps: Props = { ...props };
|
|
|
|
if (!('placeholderTextColor' in finalProps)) finalProps.placeholderTextColor = theme.colorFaded;
|
|
if (!('underlineColorAndroid' in finalProps)) finalProps.underlineColorAndroid = theme.dividerColor;
|
|
if (!('selectionColor' in finalProps)) finalProps.selectionColor = theme.textSelectionColor;
|
|
if (!('keyboardAppearance' in finalProps)) finalProps.keyboardAppearance = theme.keyboardAppearance;
|
|
if (!('style' in finalProps)) finalProps.style = {};
|
|
|
|
const defaultStyle = useMemo(() => {
|
|
const theme = themeStyle(finalProps.themeId);
|
|
|
|
return StyleSheet.create({
|
|
textInput: {
|
|
color: theme.color,
|
|
paddingLeft: 14,
|
|
paddingRight: 14,
|
|
paddingTop: 12,
|
|
paddingBottom: 12,
|
|
},
|
|
});
|
|
}, [finalProps.themeId]);
|
|
|
|
finalProps.style = [defaultStyle.textInput, finalProps.style];
|
|
|
|
return <TextInput {...finalProps} />;
|
|
};
|