react native open api generated client [Unhandled promise rejection: Error: not implemented]

Viewed 185

I have a hello world with open api from this tutorial

API schema is in here as JSON

as in the tutorial I just call the generated API client

  <Button title='API' onPress={()=> Api.Pet.getPetById(42)}/>

but is not working and getting the error

[Unhandled promise rejection: Error: not implemented]
at node_modules/react-native/Libraries/Blob/URL.js:195:10 in get__search
at Api/generated/common.ts:91:48 in setSearchParams
at Api/generated/api.ts:502:12 in getPetById
1 Answers

This is because React Native/iOS doesn't fully implement the URLSearchParams. See here: https://github.com/facebook/react-native/issues/23922

You need to polyfill it.

yarn add react-native-url-polyfill

then

import 'react-native-url-polyfill/auto';

at the top of your entry file.

Related