diff --git a/local-cli/rnpm/link/__tests__/android/applyPatch.spec.js b/local-cli/rnpm/link/__tests__/android/applyPatch.spec.js index 43af95b7c..0994b24ae 100644 --- a/local-cli/rnpm/link/__tests__/android/applyPatch.spec.js +++ b/local-cli/rnpm/link/__tests__/android/applyPatch.spec.js @@ -1,3 +1,12 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + 'use strict'; jest.autoMockOff(); @@ -8,7 +17,7 @@ describe('applyParams', () => { it('apply params to the string', () => { expect( applyParams('${foo}', {foo: 'foo'}, 'react-native') - ).toEqual('this.getResources().getString(R.string.reactNative_foo)'); + ).toEqual('getResources().getString(R.string.reactNative_foo)'); }); it('use null if no params provided', () => { diff --git a/local-cli/rnpm/link/src/android/patches/applyParams.js b/local-cli/rnpm/link/src/android/patches/applyParams.js index 44f4d1624..21c1e9545 100644 --- a/local-cli/rnpm/link/src/android/patches/applyParams.js +++ b/local-cli/rnpm/link/src/android/patches/applyParams.js @@ -1,3 +1,12 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + const toCamelCase = require('lodash').camelCase; module.exports = function applyParams(str, params, prefix) { @@ -7,7 +16,7 @@ module.exports = function applyParams(str, params, prefix) { const name = toCamelCase(prefix) + '_' + param; return params[param] - ? `this.getResources().getString(R.string.${name})` + ? `getResources().getString(R.string.${name})` : null; } );