Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alphabetTextStyle prop ref #85 #86

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ export default class Main extends React.Component<{}, { selectedItem: {} }> {
| **disabled** | `boolean` | Disable Select box | |
| **requireSelection** | `boolean` | Require at least one list item is selected | `"false"` |
| **backButtonDisabled** | `boolean` | Hide to back button | `"false"` |
| **renderSearch** | `Function` | Render custom search input | `` |
| **renderSearch** | `Function` | Render custom search input | `"false"` |
| **alphabetTextStyle** | `object` | Render custom text for the alphabetical index | `{}` |

# Core Props of React Native
<br/>
Expand Down
4 changes: 2 additions & 2 deletions dist/Components/Alphabet.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/Components/Alphabet.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/Components/Modal.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/Components/Modal.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/Interfaces/IAlphabetsInDto.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { TextStyle } from "react-native";
export interface IAlphabetsInDto {
alphabets: string[];
showAlphabeticalIndex: boolean;
selectedAlpha?: string;
alphabetTextStyle?: TextStyle;
setAlphabet: (alphabet: string) => void;
}
3 changes: 2 additions & 1 deletion dist/Interfaces/IModalProps.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference types="react" />
import { FlatListProps, TextInputProps, ModalBaseProps, ModalPropsIOS, ModalPropsAndroid } from 'react-native';
import { FlatListProps, TextInputProps, ModalBaseProps, ModalPropsIOS, ModalPropsAndroid, TextStyle } from 'react-native';
import { AnimationTypeEnum } from '../Enum';
import { IModalListInDto } from './';
declare type ModalProps = ModalBaseProps | ModalPropsIOS | ModalPropsAndroid;
Expand Down Expand Up @@ -32,6 +32,7 @@ export interface IModalProps {
renderSelectView?: (disabled: boolean, selected: IModalListInDto, showModal: () => void) => React.ReactElement;
backButtonDisabled?: boolean;
renderSearch?: (onClose: () => void, onBack: () => void) => JSX.Element;
alphabetTextStyle?: TextStyle;
}
export interface IModalState {
modalVisible: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Alphabet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class AlphabetComponent extends React.PureComponent<IAlphabetsInDto, {}>
};

public render(): JSX.Element {
const { alphabets, setAlphabet, selectedAlpha, showAlphabeticalIndex } = this.props;
const { alphabets, setAlphabet, selectedAlpha, showAlphabeticalIndex, alphabetTextStyle = {} } = this.props;

if (showAlphabeticalIndex) {
return (
Expand All @@ -27,7 +27,7 @@ export class AlphabetComponent extends React.PureComponent<IAlphabetsInDto, {}>
<TouchableOpacity onPress={() => setAlphabet(a)} key={index}
style={AlphabetStyle.alphabetButton}>
<Text
style={[AlphabetStyle.alphabetText, selectedAlpha === a && AlphabetStyle.selected]}
style={[AlphabetStyle.alphabetText, selectedAlpha === a && AlphabetStyle.selected, alphabetTextStyle]}
>
{a}
</Text>
Expand Down
5 changes: 3 additions & 2 deletions src/Components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class ModalComponent extends React.PureComponent<IModalProps, IModalState
}

public render(): JSX.Element {
const { autoSort, modalAnimationType, onClosed, showAlphabeticalIndex, searchInputTextColor, keyExtractor, showToTopButton, onEndReached, removeClippedSubviews, FlatListProps, selectPlaceholderText, searchPlaceholderText, SearchInputProps, selected, disabled, items, requireSelection, renderSelectView, ModalProps, backButtonDisabled, renderSearch } = this.props;
const { autoSort, modalAnimationType, onClosed, showAlphabeticalIndex, searchInputTextColor, keyExtractor, showToTopButton, onEndReached, removeClippedSubviews, FlatListProps, selectPlaceholderText, searchPlaceholderText, SearchInputProps, selected, disabled, items, requireSelection, renderSelectView, ModalProps, backButtonDisabled, renderSearch, alphabetTextStyle = {} } = this.props;

const { modalVisible, alphabeticalIndexChars, stickyBottomButton, selectedAlpha, selectedObject, searchText } = this.state;

Expand All @@ -95,7 +95,7 @@ export class ModalComponent extends React.PureComponent<IModalProps, IModalState
<SafeAreaView style={ModalStyles.container}>
{
renderSearch ? renderSearch(
this.onClose.bind(this),
this.onClose.bind(this),
this.onBackRequest.bind(this)
) : (
<SearchComponent
Expand Down Expand Up @@ -142,6 +142,7 @@ export class ModalComponent extends React.PureComponent<IModalProps, IModalState
setAlphabet={(alphabet: string) => this.setAlphabet(alphabet)}
alphabets={alphabeticalIndexChars}
selectedAlpha={selectedAlpha}
alphabetTextStyle={alphabetTextStyle}
/>
</View>
</KeyboardAvoidingView>
Expand Down
3 changes: 3 additions & 0 deletions src/Interfaces/IAlphabetsInDto.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import {TextStyle} from "react-native";

export interface IAlphabetsInDto {
alphabets: string[];
showAlphabeticalIndex: boolean;
selectedAlpha?: string;
alphabetTextStyle?: TextStyle;

setAlphabet: (alphabet: string) => void;
}
2 changes: 2 additions & 0 deletions src/Interfaces/IModalProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ModalBaseProps,
ModalPropsIOS,
ModalPropsAndroid,
TextStyle,
} from 'react-native';

// Local Imports
Expand Down Expand Up @@ -43,6 +44,7 @@ export interface IModalProps {
renderSelectView?: (disabled: boolean, selected: IModalListInDto, showModal: () => void) => React.ReactElement
backButtonDisabled?: boolean,
renderSearch?: (onClose: () => void, onBack: () => void ) => JSX.Element,
alphabetTextStyle?: TextStyle,
}

export interface IModalState {
Expand Down