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
1 change: 1 addition & 0 deletions docs/src/components/DynamicColorTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState, ReactNode } from 'react';

import Color from 'color';
//@ts-ignore
// eslint-disable-next-line import/no-unresolved
import { BlockPicker } from 'react-color';

import Switch from './Switch';
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/ScreenshotTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { JSX } from 'react';

//@ts-ignore
import TabItem from '@theme/TabItem';
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/ThemeColorsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { JSX } from 'react';

//@ts-ignore
import Admonition from '@theme/Admonition';
Expand Down
1 change: 1 addition & 0 deletions docs/src/utils/themes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
argbFromHex,
themeFromSourceColor,
//@ts-ignore
// eslint-disable-next-line import/no-unresolved
} from '@material/material-color-utilities';
import camelCase from 'camelcase';
import Color from 'color';
Expand Down
41 changes: 21 additions & 20 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,43 @@
"web": "EXPO_NO_TYPESCRIPT_SETUP=1 expo start --web"
},
"dependencies": {
"@expo/vector-icons": "^14.1.0",
"@expo/vector-icons": "^15.0.2",
"@expo/webpack-config": "~19.0.1",
"@pchmn/expo-material3-theme": "^1.3.2",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-native-async-storage/async-storage": "2.2.0",
"@react-native-masked-view/masked-view": "0.3.2",
"@react-navigation/bottom-tabs": "^7.3.10",
"@react-navigation/drawer": "^7.3.9",
"@react-navigation/native": "^7.1.6",
"@react-navigation/stack": "^7.2.10",
"expo": "~52.0.46",
"expo-crypto": "~14.0.2",
"expo-dev-client": "~5.0.20",
"expo-font": "~13.0.4",
"expo-keep-awake": "~14.0.3",
"expo-splash-screen": "~0.29.24",
"expo-status-bar": "~2.0.1",
"expo-updates": "~0.27.4",
"expo": "^54.0.0",
"expo-crypto": "~15.0.7",
"expo-dev-client": "~6.0.14",
"expo-font": "~14.0.9",
"expo-keep-awake": "~15.0.7",
"expo-splash-screen": "~31.0.10",
"expo-status-bar": "~3.0.8",
"expo-updates": "~29.0.12",
"file-loader": "^6.2.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-native": "0.77.2",
"react-native-gesture-handler": "~2.22.0",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-native": "0.81.4",
"react-native-gesture-handler": "~2.28.0",
"react-native-monorepo-config": "^0.1.6",
"react-native-reanimated": "~3.16.7",
"react-native-safe-area-context": "5.1.0",
"react-native-screens": "~4.8.0",
"react-native-web": "~0.19.13",
"react-native-reanimated": "~4.1.1",
"react-native-safe-area-context": "~5.6.0",
"react-native-screens": "~4.16.0",
"react-native-web": "^0.21.0",
"react-native-worklets": "0.5.1",
"typeface-roboto": "^1.1.13"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"babel-plugin-module-resolver": "^5.0.0",
"babel-preset-expo": "~12.0.0",
"babel-preset-expo": "~54.0.0",
"url-loader": "^4.1.1"
},
"engines": {
"node": ">=18"
"node": ">=20"
}
}
10 changes: 2 additions & 8 deletions example/src/Examples/AnimatedFABExample/CustomFAB.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import React from 'react';
import {
Animated,
Platform,
StyleProp,
StyleSheet,
ViewStyle,
} from 'react-native';
import { Animated, Platform, StyleSheet, ViewStyle } from 'react-native';

import { AnimatedFAB } from 'react-native-paper';

Expand All @@ -18,7 +12,7 @@ type CustomFABProps = {
label: string;
animateFrom: 'left' | 'right';
iconMode?: 'static' | 'dynamic';
style?: StyleProp<ViewStyle>;
style?: ViewStyle;
};

const CustomFAB = ({
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
},
"dependencies": {
"@callstack/react-theme-provider": "^3.0.9",
"@react-native/babel-preset": "^0.82.1",
Copy link
Member

Choose a reason for hiding this comment

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

this should be at most devDependency and never a dependency - this will get installed with the paper itself in the projects and the projects have their own babel config.

but...

I would avoid the preset altogether since every project will use that preset with it's own babel config. In theory, running the preset in the lib should reduce the transpilation time of the library in the projects, but every file still is going to be parsed by babel and then (most likely, needs verifying) transformations will try to run again but will result in noop since it was already transformed here.

Copy link
Member

@satya164 satya164 Jan 8, 2026

Choose a reason for hiding this comment

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

iirc it's needed for tests etc.

the lib isn't actually compiled with this since bob has an internal Babel config unless overridden. the main benefit of precompiling is to make it seamlessly work with anything other than metro (jest, vite, webpack) since they don't compile node_modules by default.

"color": "^3.1.2",
"use-latest-callback": "^0.2.3"
},
Expand All @@ -69,9 +70,9 @@
"@types/color": "^3.0.0",
"@types/jest": "^29.2.1",
"@types/node": "^13.1.0",
"@types/react-dom": "^18.3.1",
"@types/react-dom": "^19.1.1",
"@types/react-native-vector-icons": "^6.4.18",
"@types/react-test-renderer": "^18.3.0",
"@types/react-test-renderer": "^19.1.0",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"all-contributors-cli": "^6.24.0",
Expand All @@ -92,15 +93,15 @@
"jest": "^29.6.3",
"jest-file-snapshot": "^0.3.2",
"metro-react-native-babel-preset": "0.73.9",
Copy link
Member

Choose a reason for hiding this comment

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

should be removed since this is deprecated nowadays

"react": "18.3.1",
"react": "19.1.1",
"react-dom": "18.3.1",
"react-native": "0.77.0",
"react-native": "0.82.1",
"react-native-builder-bob": "^0.21.3",
"react-native-safe-area-context": "5.1.0",
"react-test-renderer": "18.3.1",
"react-native-safe-area-context": "5.5.2",
"react-test-renderer": "19.1.1",
"release-it": "^13.4.0",
"rimraf": "^3.0.2",
"typescript": "5.0.4"
"typescript": "5.8.3"
},
"peerDependencies": {
"react": "*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { JSX } from 'react';
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't be needed to import this, probably a configuration issue somewhere

import { Animated, Platform, View, ViewProps } from 'react-native';

interface Props extends ViewProps {
Expand Down
1 change: 1 addition & 0 deletions src/components/Typography/AnimatedText.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { JSX } from 'react';
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't be needed to import this, probably a configuration issue somewhere

import {
Animated,
I18nManager,
Expand Down
1 change: 1 addition & 0 deletions src/components/Typography/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { JSX } from 'react';
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't be needed to import this, probably a configuration issue somewhere

import {
I18nManager,
StyleProp,
Expand Down
60 changes: 26 additions & 34 deletions src/components/__tests__/Appbar/__snapshots__/Appbar.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -565,23 +565,19 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
<View
collapsable={false}
style={
[
{
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
{
"opacity": 1,
"transform": [
{
"rotate": "0deg",
},
],
},
]
{
"bottom": 0,
"left": 0,
"opacity": 1,
"position": "absolute",
"right": 0,
"top": 0,
"transform": [
{
"rotate": "0deg",
},
],
}
}
testID="cross-fade-icon-current"
>
Expand Down Expand Up @@ -812,23 +808,19 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
<View
collapsable={false}
style={
[
{
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
{
"opacity": 1,
"transform": [
{
"rotate": "0deg",
},
],
},
]
{
"bottom": 0,
"left": 0,
"opacity": 1,
"position": "absolute",
"right": 0,
"top": 0,
"transform": [
{
"rotate": "0deg",
},
],
}
}
testID="cross-fade-icon-current"
>
Expand Down
5 changes: 0 additions & 5 deletions src/components/__tests__/Dialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import { act, fireEvent, render } from '@testing-library/react-native';
import Dialog from '../../components/Dialog/Dialog';
import Button from '../Button/Button';

jest.mock('react-native/Libraries/Utilities/BackHandler', () =>
// eslint-disable-next-line jest/no-mocks-import
require('react-native/Libraries/Utilities/__mocks__/BackHandler')
);

interface BackHandlerStatic extends RNBackHandlerStatic {
mockPressBack(): void;
}
Expand Down
44 changes: 33 additions & 11 deletions src/components/__tests__/Menu.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Animated, StyleSheet, View } from 'react-native';
import { Animated, Dimensions, StyleSheet, View } from 'react-native';

import { act, render, screen, waitFor } from '@testing-library/react-native';

Expand Down Expand Up @@ -93,6 +93,16 @@ it('renders menu with content styles', () => {
);

it('uses the default anchorPosition of top', async () => {
const dimensionsSpy = jest.spyOn(Dimensions, 'get').mockReturnValue({
width: 400,
height: 800,
scale: 2,
fontScale: 2,
});
const measureSpy = jest
.spyOn(View.prototype, 'measureInWindow')
.mockImplementation((fn) => fn(100, 100, 80, 32));

function makeMenu(visible: boolean) {
return (
<Portal.Host>
Expand All @@ -115,15 +125,13 @@ it('uses the default anchorPosition of top', async () => {

render(makeMenu(false));

jest
.spyOn(View.prototype, 'measureInWindow')
.mockImplementation((fn) => fn(100, 100, 80, 32));

// You must update instead of creating directly and using it because
// componentDidUpdate isn't called by default in jest. Forcing the update
// than triggers measureInWindow, which is how Menu decides where to show
// itself.
screen.update(makeMenu(true));
await act(async () => {
screen.update(makeMenu(true));
});

await waitFor(() => {
const menu = screen.getByTestId('menu-view');
Expand All @@ -133,9 +141,22 @@ it('uses the default anchorPosition of top', async () => {
top: 100,
});
});

measureSpy.mockRestore();
dimensionsSpy.mockRestore();
});

it('respects anchorPosition bottom', async () => {
const dimensionsSpy = jest.spyOn(Dimensions, 'get').mockReturnValue({
width: 400,
height: 800,
scale: 2,
fontScale: 2,
});
const measureSpy = jest
.spyOn(View.prototype, 'measureInWindow')
.mockImplementation((fn) => fn(100, 100, 80, 32));

function makeMenu(visible: boolean) {
return (
<Portal.Host>
Expand All @@ -159,11 +180,9 @@ it('respects anchorPosition bottom', async () => {

render(makeMenu(false));

jest
.spyOn(View.prototype, 'measureInWindow')
.mockImplementation((fn) => fn(100, 100, 80, 32));

screen.update(makeMenu(true));
await act(async () => {
screen.update(makeMenu(true));
});

await waitFor(() => {
const menu = screen.getByTestId('menu-view');
Expand All @@ -173,6 +192,9 @@ it('respects anchorPosition bottom', async () => {
top: 132,
});
});

measureSpy.mockRestore();
dimensionsSpy.mockRestore();
});

it('animated value changes correctly', () => {
Expand Down
5 changes: 0 additions & 5 deletions src/components/__tests__/Modal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ interface BackHandlerStatic extends RNBackHandlerStatic {

const BackHandler = RNBackHandler as BackHandlerStatic;

jest.mock('react-native/Libraries/Utilities/BackHandler', () =>
// eslint-disable-next-line jest/no-mocks-import
require('react-native/Libraries/Utilities/__mocks__/BackHandler')
);

describe('Modal', () => {
beforeAll(() => {
jest.useFakeTimers();
Expand Down
Loading