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

psuedo class first-child error #3652

Closed
wants to merge 9 commits into from
2 changes: 1 addition & 1 deletion docs/App/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class Header extends Component<HeaderProps, HeaderState> {
componentDidMount() {
this.getStarCount();
}
componentWillReceiveProps({ location }: HeaderProps) {
UNSAFE_componentWillReceiveProps({ location }: HeaderProps) {
const valid = ['/', '/home'];
const shouldCollapse = !valid.includes(this.props.location.pathname);
if (location.pathname !== this.props.location.pathname && shouldCollapse) {
Expand Down
5 changes: 3 additions & 2 deletions docs/examples/AsyncCallbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ const loadOptions = (inputValue, callback) => {
}, 1000);
};

export default class WithCallbacks extends Component<*, State> {
export default class WithCallbacks extends Component<State> {
state = { inputValue: '' };
handleInputChange = (newValue: string) => {
const inputValue = newValue.replace(/\W/g, '');
//const inputValue = newValue.replace(/\W/g, '');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for a special character, so we can enter them same as in promise

const inputValue = newValue;
this.setState({ inputValue });
return inputValue;
};
Expand Down
2 changes: 1 addition & 1 deletion docs/markdown/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const Heading = props => {
}
const css = {
marginTop: 0,
'&:not(:first-child)': { marginTop: 30 },
'&:not(:first-of-type)': { marginTop: 30 },

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an open issue we could link for this fix?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess no. I found it in the console panel

};

return linkify ? (
Expand Down
2 changes: 1 addition & 1 deletion packages/react-select/src/Async.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const makeAsyncSelect = <C: {}>(
});
}
}
componentWillReceiveProps(nextProps: C & AsyncProps) {
UNSAFE_componentWillReceiveProps(nextProps: C & AsyncProps) {
// if the cacheOptions prop changes, clear the cache
if (nextProps.cacheOptions !== this.props.cacheOptions) {
this.optionsCache = {};
Expand Down
2 changes: 1 addition & 1 deletion packages/react-select/src/Creatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const makeCreatableSelect = <C: {}>(
options: options,
};
}
componentWillReceiveProps(nextProps: CreatableProps & C) {
UNSAFE_componentWillReceiveProps(nextProps: CreatableProps & C) {
const {
allowCreateWhileLoading,
createOptionPosition,
Expand Down
14 changes: 7 additions & 7 deletions packages/react-select/src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ export default class Select extends Component<Props, State> {
this.focusInput();
}
}
componentWillReceiveProps(nextProps: Props) {
UNSAFE_componentWillReceiveProps(nextProps: Props) {
const { options, value, menuIsOpen, inputValue } = this.props;
// re-cache custom components
this.cacheComponents(nextProps.components);
Expand Down Expand Up @@ -484,12 +484,12 @@ export default class Select extends Component<Props, State> {

openMenu(focusOption: 'first' | 'last') {
const { menuOptions, selectValue, isFocused } = this.state;
const { isMulti } = this.props;
const { isMulti, options } = this.props;
let openAtIndex =
focusOption === 'first' ? 0 : menuOptions.focusable.length - 1;

if (!isMulti) {
const selectedIndex = menuOptions.focusable.indexOf(selectValue[0]);
const selectedIndex = options.indexOf(selectValue[0]);
if (selectedIndex > -1) {
openAtIndex = selectedIndex;
}
Expand All @@ -502,7 +502,7 @@ export default class Select extends Component<Props, State> {
this.onMenuOpen();
this.setState({
focusedValue: null,
focusedOption: menuOptions.focusable[openAtIndex],
focusedOption: options[openAtIndex],
});

this.announceAriaLiveContext({ event: 'menu' });
Expand Down Expand Up @@ -773,9 +773,9 @@ export default class Select extends Component<Props, State> {
}

getNextFocusedOption(options: OptionsType) {
const { focusedOption: lastFocusedOption } = this.state;
return lastFocusedOption && options.indexOf(lastFocusedOption) > -1
? lastFocusedOption
const { selectValue: lastFocusedOption } = this.state;
return lastFocusedOption && options.indexOf(lastFocusedOption[0]) > -1
? lastFocusedOption[0]
: options[0];
}
getOptionLabel = (data: OptionType): string => {
Expand Down