Skip to content

Commit

Permalink
fix: make text non selectable if inside a button
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLindhout authored and Trancever committed Dec 8, 2020
1 parent 8e22993 commit 0bd2cab
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/BottomNavigation.tsx
Expand Up @@ -962,6 +962,7 @@ class BottomNavigation extends React.Component<Props, State> {
})
) : (
<Text
selectable={false}
style={[
styles.label,
{ color: activeTintColor },
Expand All @@ -986,6 +987,7 @@ class BottomNavigation extends React.Component<Props, State> {
})
) : (
<Text
selectable={false}
style={[
styles.label,
{ color: inactiveTintColor },
Expand Down
1 change: 1 addition & 0 deletions src/components/Button.tsx
Expand Up @@ -291,6 +291,7 @@ const Button = ({
/>
) : null}
<Text
selectable={false}
numberOfLines={1}
style={[
styles.label,
Expand Down
1 change: 1 addition & 0 deletions src/components/Chip.tsx
Expand Up @@ -288,6 +288,7 @@ const Chip = ({
</View>
) : null}
<Text
selectable={false}
numberOfLines={1}
style={[
styles.text,
Expand Down
1 change: 1 addition & 0 deletions src/components/Drawer/DrawerItem.tsx
Expand Up @@ -102,6 +102,7 @@ const DrawerItem = ({
<View style={styles.wrapper}>
{icon ? <Icon source={icon} size={24} color={contentColor} /> : null}
<Text
selectable={false}
numberOfLines={1}
style={[
styles.label,
Expand Down
1 change: 1 addition & 0 deletions src/components/FAB/FAB.tsx
Expand Up @@ -229,6 +229,7 @@ const FAB = ({
) : null}
{label ? (
<Text
selectable={false}
style={[
styles.label,
uppercase && styles.uppercaseLabel,
Expand Down
2 changes: 2 additions & 0 deletions src/components/List/ListAccordion.tsx
Expand Up @@ -187,6 +187,7 @@ const ListAccordion = ({
: null}
<View style={[styles.item, styles.content]}>
<Text
selectable={false}
numberOfLines={titleNumberOfLines}
style={[
styles.title,
Expand All @@ -200,6 +201,7 @@ const ListAccordion = ({
</Text>
{description && (
<Text
selectable={false}
numberOfLines={descriptionNumberOfLines}
style={[
styles.description,
Expand Down
4 changes: 4 additions & 0 deletions src/components/List/ListItem.tsx
Expand Up @@ -16,6 +16,7 @@ import type { $RemoveChildren, EllipsizeProp } from '../../types';
type Description =
| React.ReactNode
| ((props: {
selectable: boolean;
ellipsizeMode: EllipsizeProp | undefined;
color: string;
fontSize: number;
Expand Down Expand Up @@ -144,12 +145,14 @@ const ListItem = ({
) => {
return typeof description === 'function' ? (
description({
selectable: false,
ellipsizeMode: descriptionEllipsizeMode,
color: descriptionColor,
fontSize: styles.description.fontSize,
})
) : (
<Text
selectable={false}
numberOfLines={descriptionNumberOfLines}
ellipsizeMode={descriptionEllipsizeMode}
style={[
Expand Down Expand Up @@ -186,6 +189,7 @@ const ListItem = ({
: null}
<View style={[styles.item, styles.content]}>
<Text
selectable={false}
ellipsizeMode={titleEllipsizeMode}
numberOfLines={titleNumberOfLines}
style={[styles.title, { color: titleColor }, titleStyle]}
Expand Down
1 change: 1 addition & 0 deletions src/components/Menu/MenuItem.tsx
Expand Up @@ -126,6 +126,7 @@ class MenuItem extends React.Component<Props> {
pointerEvents="none"
>
<Text
selectable={false}
numberOfLines={1}
style={[styles.title, { color: titleColor }, titleStyle]}
>
Expand Down
3 changes: 3 additions & 0 deletions src/components/__tests__/__snapshots__/Banner.test.js.snap
Expand Up @@ -231,6 +231,7 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -411,6 +412,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -506,6 +508,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down
Expand Up @@ -3164,6 +3164,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -3201,6 +3202,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -3432,6 +3434,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -3469,6 +3472,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -3700,6 +3704,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -3737,6 +3742,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -4098,6 +4104,7 @@ exports[`renders custom icon and label with custom colors in shifting bottom nav
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -4329,6 +4336,7 @@ exports[`renders custom icon and label with custom colors in shifting bottom nav
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -4560,6 +4568,7 @@ exports[`renders custom icon and label with custom colors in shifting bottom nav
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -4901,6 +4910,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -4938,6 +4948,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -5169,6 +5180,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -5206,6 +5218,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -5437,6 +5450,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -5474,6 +5488,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -5835,6 +5850,7 @@ exports[`renders shifting bottom navigation 1`] = `
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -6066,6 +6082,7 @@ exports[`renders shifting bottom navigation 1`] = `
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -6297,6 +6314,7 @@ exports[`renders shifting bottom navigation 1`] = `
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -6528,6 +6546,7 @@ exports[`renders shifting bottom navigation 1`] = `
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -6759,6 +6778,7 @@ exports[`renders shifting bottom navigation 1`] = `
}
>
<Text
selectable={false}
style={
Array [
Object {
Expand Down
10 changes: 10 additions & 0 deletions src/components/__tests__/__snapshots__/Button.test.js.snap
Expand Up @@ -55,6 +55,7 @@ exports[`renders button with color 1`] = `
>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -151,6 +152,7 @@ exports[`renders button with custom testID 1`] = `
>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -290,6 +292,7 @@ exports[`renders button with icon 1`] = `
</View>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -431,6 +434,7 @@ exports[`renders button with icon in reverse order 1`] = `
</View>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -533,6 +537,7 @@ exports[`renders contained contained with mode 1`] = `
>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -628,6 +633,7 @@ exports[`renders disabled button 1`] = `
>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -908,6 +914,7 @@ exports[`renders loading button 1`] = `
</View>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -1003,6 +1010,7 @@ exports[`renders outlined button with mode 1`] = `
>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -1098,6 +1106,7 @@ exports[`renders text button by default 1`] = `
>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down Expand Up @@ -1193,6 +1202,7 @@ exports[`renders text button with mode 1`] = `
>
<Text
numberOfLines={1}
selectable={false}
style={
Array [
Object {
Expand Down

0 comments on commit 0bd2cab

Please sign in to comment.